const String jsonKeyLandmarkBeanLandmark = 'landmark';
const String jsonKeyLandmarkBeanMedalIcon = 'medal_icon';
const String jsonKeyLandmarkBeanMedalBg = 'medal_bg';
const String jsonKeyLandmarkBeanCoin = 'coin';
const String jsonKeyLandmarkBeanDescription = 'description';
const String jsonKeyLandmarkBeanUnlock = 'unlock';
const String jsonKeyLandmarkBeanLandmarkId = 'landmarkId';

class LandmarkBean {
  String? landmark;
  String? medalIcon;
  String? medalBg;
  int? coin;
  String? description;
  int? unlock;
  String? landmarkId;

  ///是否已解锁
  bool get isUnlock => unlock != 0;

  LandmarkBean({
    this.landmark,
    this.medalIcon,
    this.medalBg,
    this.coin,
    this.description,
    this.unlock,
    this.landmarkId,
  });

  LandmarkBean.fromJson(dynamic json) {
    if (json[jsonKeyLandmarkBeanLandmark] is String) {
      landmark = json[jsonKeyLandmarkBeanLandmark];
    }
    if (json[jsonKeyLandmarkBeanMedalIcon] is String) {
      medalIcon = json[jsonKeyLandmarkBeanMedalIcon];
    }
    if (json[jsonKeyLandmarkBeanMedalBg] is String) {
      medalBg = json[jsonKeyLandmarkBeanMedalBg];
    }
    if (json[jsonKeyLandmarkBeanCoin] is int) {
      coin = json[jsonKeyLandmarkBeanCoin];
    }
    if (json[jsonKeyLandmarkBeanDescription] is String) {
      description = json[jsonKeyLandmarkBeanDescription];
    }
    if (json[jsonKeyLandmarkBeanUnlock] is int) {
      unlock = json[jsonKeyLandmarkBeanUnlock];
    }
    if (json[jsonKeyLandmarkBeanLandmarkId] is String) {
      landmarkId = json[jsonKeyLandmarkBeanLandmarkId];
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> _data = <String, dynamic>{};
    _data[jsonKeyLandmarkBeanLandmark] = landmark;
    _data[jsonKeyLandmarkBeanMedalIcon] = medalIcon;
    _data[jsonKeyLandmarkBeanMedalBg] = medalBg;
    _data[jsonKeyLandmarkBeanCoin] = coin;
    _data[jsonKeyLandmarkBeanDescription] = description;
    _data[jsonKeyLandmarkBeanUnlock] = unlock;
    _data[jsonKeyLandmarkBeanLandmarkId] = landmarkId;
    return _data;
  }
}
